<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php
        // put your code here
        echo "<br><div align=\center\">premier scriptphp</div>";
        echo"toto";
        // commentaire une seule ligne
        /*
         * 
         * comm. plusieurs lignes
         */
        $nom = 1;
        echo "<div>$nom</div>";
        $nom = "DUPONT";
       
        echo "<div>$nom</div>";   
         echo "<div>".$nom."</div>";
      
        echo '<div>$nom</div>';   //  simple quote: affiche '$nom'
        echo "<div>".$nom."</div>";
        define("constante", "45");
        echo "<div>".$nom."</div>";
         echo "<div>".constante."</div>";
         
         $nombre1 = 45;
         $nombre2 = "45";
         echo $nombre1 + $nombre2;
         
         echo $nombre1." ".$nombre2;
         
         $b1 = true; // ou $b1 = 1
         $b2 = false; // ou $b2 = 0
         
         //PROGRAMME TEST
         $age = 15;
         
         if($age < 16) {
             echo "refusé!";
             echo "vous avez moind de 18 ans";
         } 
         else if($age<18){
             echo "vos devez etre accompagne";
         }
         else {
             echo "accepté !";
         }
           
         $x=10;
         echo ++$x; //affiche 11
         $x=10;
         echo "$x++"; //affiche 10
         echo "<br>";
         echo $x; //arffiche 11
         echo "<br>";
        
         echo"BOUCLE FOR :<br>";
         for($x=0; $x<10; $x++) {
             echo $x;
             echo"<br>";
         }
         
         echo"BOUCLE WHILE: <br>";
         $x=0;    
         while($x<10){
               echo $x;
               $x++;
             echo"<br>";
         }
 
          echo"BOUCLE DO.....WHILE: <br>";
         $x=0;    
         do {
               echo $x;
               $x++;
         } while($x<10);
         
         echo "<br>";
         echo rand();
         //echo rand(500, 550);
 
       ?>
    </body>
</html>
